//
//  XZResManagementCell.m
//  Teecloud
//
//  Created by PC on 2018/10/22.
//  Copyright © 2018年 小志. All rights reserved.
//

#import "XZResManagementCell.h"
#import "XZResManagemen.h"
#import "DeviceInfoManager.h"
@interface XZResManagementCell ()
//图片
@property (weak, nonatomic) IBOutlet UIImageView *iconImg;
//名称
@property (weak, nonatomic) IBOutlet UILabel *title;
//视频 文档 ==
@property (weak, nonatomic) IBOutlet UIButton *subTitle;
//老师名称 来源
@property (weak, nonatomic) IBOutlet UILabel *teacherName;
//手机型号
@property (weak, nonatomic) IBOutlet UILabel *mobileModel;


@end

@implementation XZResManagementCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (void)setModel:(XZResManagemen *)model{
    _model = model;
    [self.iconImg yy_setImageWithURL:[NSURL URLWithString:model.HeadUrl] placeholder:DefealtImg];
    self.title.text = model.Name;
    [self.subTitle setTitle:model.ResTypeName forState:UIControlStateNormal];
    if ([model.ResTypeName isEqualToString:@"课程包"]) {
        self.subTitle.layer.borderWidth =1.0;
        self.subTitle.layer.borderColor =kRedColor.CGColor;
        [self.subTitle setTitleColor:kRedColor forState:0];
        self.subTitle.layer.cornerRadius=3;
    }else{
        self.subTitle.layer.borderWidth =1.0;
        self.subTitle.layer.borderColor =[UIColor colorWithHexString:@"FF7708"].CGColor;
        [self.subTitle setTitleColor:[UIColor colorWithHexString:@"FF7708"] forState:0];
        self.subTitle.layer.cornerRadius=3;
    }
    self.teacherName.text = model.FromName;
    
    self.mobileModel.text = model.MobileModel;
    //判断机型是否一致
    const NSString *mobileModel = [[DeviceInfoManager sharedManager] getDeviceName];
    if (![mobileModel isEqualToString:model.MobileModel]) {
        self.mobileModel.textColor = kRedColor;
    }else{
        self.mobileModel.textColor = [UIColor colorWithHexString:@"82D06D" andAlpha:1.0f];
    }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
